package com.bawei.login.model

import com.bawei.login.api.LoginApiServer
import com.bw.lib_common.entity.BaseResponse
import com.bw.lib_common.entity.UserEntity
import com.bw.lib_common.model.BaseRepository
import com.bw.lib_http.OkHttpClientManager

/**
 * 登录接口的repo实例
 */

class LoginRepository : BaseRepository<LoginApiServer>() {

    //private val userDao = RoomDBUtils.getDataBase().getUserInfoDao()
    override fun createApiServer(): LoginApiServer = OkHttpClientManager.retrofitInstance.create(LoginApiServer::class.java)
    suspend fun loginToServer(password:String,username:String):BaseResponse<UserEntity> = apiService.loginToServer(password,username)

    suspend fun registerToServer(password:String,username:String):BaseResponse<UserEntity> = apiService.registerToServer(password,username)

    suspend fun saveUserinfoToRoom(user: UserEntity){
        //userDao.insertUserInfo(entity)
    }

//    suspend fun queryUserInfoFromRoom(userId: Int): UserInfoEntity{
//        return userDao.queryUserInfoById(userId)
//    }

}
